<include file="Inc/html_header" />
<div class="searchBox mySelect">
    省份：<span id="province_select_ele"><?php echo $province_select;?></span>
    城市：<span id="city_select_ele"><?php echo $city_select;?></span>
    区县：<span id="district_select_ele"><?php echo $district_select;?></span>
    乡镇：<span id="town_select_ele"><?php echo $town_select;?></span>
</div>
<div class="mtop10">
    <table class="table table-bordered table-hover">
        <thead>
            <tr>
                <th width="110">ID</th>
                <th>名称&nbsp;&nbsp;&nbsp;[<?php echo empty($ups) ? '中国' : implode(' - ', getSingleKey($ups, 'area_name')); ?>]</th>
                <th width="50">级别</th>
            </tr>
        </thead>
        <tbody>
            <?php if( ! empty($infos)){ foreach($infos as $table){ $table['level'] = intval($table['level']); ?>
            <tr>
                <td>
                    <?php echo $table['id'];?>
                </td>
                <td>
                    <a href="<?php if($table['level'] < 4){ echo U('zone/index',array('pid'=>$table['id'])); }else{ echo 'javascript:;'; } ?>">
                        <?php echo $table['area_name'];?>
                    </a>
                </td>
                <td><?php echo $levels[$table['level']]; ?></td>
            </tr>
            <?php }}else{ ?>
            <tr>
                <td colspan="3" class="text-center"> 暂时还没有内容! </td>
            </tr>
            <?php } ?>
        </tbody>
    </table>
</div>
<script type="text/javascript">
    function resetBehindSelect(id)
    {
        id = $.trim(id);
        $('#'+id).nextAll('span').html('<?php echo $blank_select; ?>'); 
    }

    function getCity(ProvinceId)
    {
        ProvinceId = parseInt(ProvinceId);
        if(isNaN(ProvinceId) || ProvinceId<1){
            resetBehindSelect('province_select_ele');
            return ;
        }
        $.ajax({
            url:'/zone/pass_ajax_get_city_select',
            data:{ "ProvinceId":ProvinceId },
            type:'get',
            success:function(msg){
                if(msg.st == 'y'){
                    $('#city_select_ele').html(msg.htm);
                    resetBehindSelect('city_select_ele');
                }else{
                    alert(msg.note);
                }
            },
            error:function(){
                alert('网络繁忙，请稍候重试。');
            }
        });
    }
    
     function getDistrict(CityId)
    {
        CityId = parseInt(CityId);
        if(isNaN(CityId) || CityId<1){
            resetBehindSelect('city_select_ele');
            return;
        }
        $.ajax({
            url:'/zone/pass_ajax_get_district_select',
            data:{ "CityId":CityId },
            type:'get',
            success:function(msg){
                if(msg.st == 'y'){
                    $('#district_select_ele').html(msg.htm);
                    resetBehindSelect('district_select_ele');
                }else{
                    alert(msg.note);
                }
            },
            error:function(){
                alert('网络繁忙，请稍候重试。');
            }
        });
    }
    
     function getTown(DistrictId)
    {
        DistrictId = parseInt(DistrictId);
        if(isNaN(DistrictId) || DistrictId<1){
            resetBehindSelect('district_select_ele');
            return;
        }
        $.ajax({
            url:'/zone/pass_ajax_get_town_select',
            data:{ "DistrictId":DistrictId },
            type:'get',
            success:function(msg){
                if(msg.st == 'y'){
                    $('#town_select_ele').html(msg.htm);
                }else{
                    alert(msg.note);
                }
            },
            error:function(){
                alert('网络繁忙，请稍候重试。');
            }
        });
    }
</script>
<include file="Inc/html_footer" />